package edu.hubu.talentmanagementsystem.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import edu.hubu.talentmanagementsystem.model.ext.StaffEvaluation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

@Mapper
public interface StaffEvaluationMapper extends BaseMapper<StaffEvaluation> {
    int insert(StaffEvaluation entity);

    int deleteById(Serializable id);

    int deleteByMap(@Param("cm") Map<String, Object> columnMap);

    int delete(@Param("ew") Wrapper<StaffEvaluation> queryWrapper);

    int deleteBatchIds(@Param("coll") Collection<? extends Serializable> idList);

    int updateById(@Param("et") StaffEvaluation entity);

    int update(@Param("et") StaffEvaluation entity, @Param("ew") Wrapper<StaffEvaluation> updateWrapper);

    StaffEvaluation selectById(Serializable id);

    List<StaffEvaluation> selectBatchIds(@Param("coll") Collection<? extends Serializable> idList);

    List<StaffEvaluation> selectByMap(@Param("cm") Map<String, Object> columnMap);

    StaffEvaluation selectOne(@Param("ew") Wrapper<StaffEvaluation> queryWrapper);

    Integer selectCount(@Param("ew") Wrapper<StaffEvaluation> queryWrapper);

    List<StaffEvaluation> selectList(@Param("ew") Wrapper<StaffEvaluation> queryWrapper);

    List<Map<String, Object>> selectMaps(@Param("ew") Wrapper<StaffEvaluation> queryWrapper);

    List<Object> selectObjs(@Param("ew") Wrapper<StaffEvaluation> queryWrapper);

    <E extends IPage<StaffEvaluation>> E selectPage(E page, @Param("ew") Wrapper<StaffEvaluation> queryWrapper);

    <E extends IPage<Map<String, Object>>> E selectMapsPage(E page, @Param("ew") Wrapper<StaffEvaluation> queryWrapper);

    @Select("select * from staff_evaluation where staff_evaluation_id in " +
            "(select staff_archival_evaluation_id from staff_archival " +
            "where staff_archival_staff_id = #{staffId})")
    @Result(column = "staff_archival_company_id",property = "company",
    one = @One(select = "edu.hubu.talentmanagementsystem.mapper.CompanyMapper.selectNameById"))
    List<StaffEvaluation> selectByStaffId(Integer staffId);
}